<?php
    include_once("../service/bannerService.php");
    
    $banID = $_POST['checkbox'];
    $banIDs = count($_POST['checkbox']);
    
    if(!isset($banID) || !isset($banIDs)){
        echo "<script>window.location = '../admin-page/banner.php'</script>";
    }

    for($i = 0; $i < $banIDs; $i++){
        $delID = $banID[$i];
        $actionResult = deleteBannerBy($delID);
    }
    
    if($actionResult)
        echo "<script>window.location = '../admin-page/banner.php?actionResult=ok'</script>";
    else
        echo "<script>window.location = '../admin-page/banner.php?actionResult=no'</script>";
?>
